How To Make And Manage Types
Back to Wiki Help Suggestions and Tasks UNDER CONSTRUCTION Types are managed by , which can be used for any FireRed or LeafGreen based game. This tutorial uses basic knowledge of: *GBA Graphics Editor *Capable hex editor *Compatible image software (using PNG's to ensure data retention) *Notepad or similar *.ods (OpenOffice) compatible spreadsheet software This tutorial will be expanded to give more specific and visual instruction as time allows, but if you are more versed in the software listed above you will be able to use the spreadsheet to completely manage types for games of the known FireRed/LeafGreen ROMs. There are many parts to the Types in the game. There is the Icons that show the type(s) of moves and Pokemon/Ponymon on status screens and Dex screens. However there is more to it behind the scenes including: *The pointers that locate each of the below in the ROM (some have multiple pointers) *The type name table *The icons are stored on a tile set that includes other items *The color pallet that is used for the Icons, but also affects other elements in the game *The type icon locator table that finds the type icon and other sprites on the tile set *The interactions table that controls the type interactions that are not 1 to 1 __TOC__ 'To Re-purpose Or To Add' You can keep the original number of types in your game, but some attacks and defenses have special coding that treats certain types differently. Re-purposing types transfers the special interactions to the new ones. This often leads to unexpected and sometimes frustrating effects during battle. It is easy to avoid this by only adding new types. Adding is fairly easy, and is more so if you have basic experience and knowledge of hex editing. When type addition is chosen it is a very helpful and time saving practice to reserve space for more types in case it becomes helpful to add more later. The spreadsheet tables handle up to 58 types. That is ID#0 thru ID#62 with ID#18 thru ID#22 being used for another purpose. This was a balance of possible data space used for that number of types, and making sure to not run out of types to categorize moves and Dex entries. Originally this project was not going to use the original types, but now it uses most of the original types and has expanded to use several more than expected. The data is packed tightly in the ROMs, so any additions to the game will mean moving data and re-pointing the pointers to the new locations for all of the type data except the icon pallet. There is a LOT of unused space in the ROMs, so most mods are small enough not to have to worry about running out of room, or removing the old unused data. There are two large chunks of the ROM that are empty (filled with "FF"). One in the middle, and one at the end. This makes it easy to find open sections to transfer expanded data. 'Pointers' Pointers are used by the Script of the ROM to find information stored in the ROM. A pointer is used to find a script, data, image, the beginning of a table or other types of information. The pointers are stored in the ROM with the least significant byte first, and ends in 08. This is because the when the ROM data is accessed it is in the device memory. The ROM data starts at 08000000h, so when the game script executes, 08 must be at the beginning of the ROM offset to point to the location in the memory with the corresponding ROM data. To convert between Rom offset and pointer, reverse the order of the pairs of numbers and add or remove the 08 at the end. Visually this is represented by 123456h <-> 56 34 12 08h, so for ROM offset 123456h the pointer would look like 56 34 12 08h. 'Importing And Exporting' For each table there is usually a column for importing data from the ROM, and a column for exporting data to the ROM. If there is a import (or "ROM Dump") column, the area is usually marked with a light yellow (Yellow 10) background. Usually the export data is in a column with a mid green (Turquoise 2) background, and often has changed data highlighted in deep red (Red). To import, follow the instructions in light blue (Cyan) at the top of the table to set the hex editor so that the data is copied in a manner that will directly dump into the table. This is where it is critical that the hex editor is "capable". It must be able to copy and paste into other programs as it is grouped in rows as shown in the hex editor view/edit window. Once the hex editor is set per instructions, copy the data (using the "Hex Text" button in HexEdit). Then go to the first cell of the import column mentioned in the same instructions. Exporting the data to the ROM takes a couple more steps. First highlight the data to export to the ROM. This can be all or part of the table's output data. Pay close attention to the ROM location in the cell adjacent to the top data cell that is selected. Then copy and paste this selection into Notepad or similar program. Notepad works perfect for this since it does not format the text. Some table exports will leave A LOT of extra spaces, so don't worry if you see them. They are unimportant and will be ignored by the hex editor. Save it to a .txt file. Go to the hex editor and open a new blank workspace (in HexEdit File>New then SizeSpecified:0). import the .txt to the new workspace (in HexEdit File>Import>Hex Text). The imported data will be highlighted so just copy the data and go to the ROM location that was adjacent to the start of the selected data from the spreadsheet table. This is the ROM location that was mentioned to "pay close attention to" above. Make sure it is in OVR (overstrike) mode at the bottom right in the status bar. If it says "INS" (insert mode) double click on it to change it to "OVR". Then paste the data starting at that ROM location. If it highlighted the imported data in orange it is in insert mode, and you must undo the paste and change mode to overstrike before pasting again. Don't forget to save (in HexEdit an * appears next to the file name in the title bar at the top of the window if changes have not been saved). 'Names' The spreadsheet uses two forms of the Type names. The full spelling form is used to refer to the Type on the spreadsheets and on the wiki. These are managed on column A of the "TypeInteractions" tab. The shortened form is used in the game since there is only six usable characters for each in the names table of the ROM. The rest of this section refers to the shortened form for the ROM. The "Names" tab manages the type names and has the list of the full name from the "TypeInteractions" tab to make sure the order matches the rest of the data. Simply type in the new names into column G to change the names. Refer to the "Importing And Exporting" section above to transfer data between the ROM and spreadsheet tables. 'Icon Sprites' Type icon sprites are managed on the "Icon" Tab. It includes where to find, and how to handle the tile set and color pallet. The width of the image must stay the same, but more space can be added at the bottom in increments of 16 pixels. The Icons can be added where there is unused space on the Icon tile set, but it is handy to keep them in the same order as the types in order of ID#. The original Icons were reordered on the tile set to match the ID# order for this project. The Icon table can handle having them in no particular order, so it is up to your preference how this is handled. It is handy to use an image editor that handles layers to separate the icon background from the Icon lettering. This makes it quick and easy to change or move the text, or use other text to create the text for new types. Make sure to export to PNG in order to keep the data integrity of the tile set. To extract the tile set from the ROM, Set GBA Graphics Editor Image Control (Windows>Image Control) and Pallet Control (Windows>Image Control) as specified per ROM and select as bitmap. When importing a tile set to the ROM, set GBA Graphics Editor the same as to extract it. Instead of "Save as bitmap" select a bitmap. Change the "Graphics Offset" to a new location if you are expanding the tile set image for more types. Make sure "Import Graphics" is checked, and the rest is unchecked for both Graphics and Pallet sections. "Abort if new graphics are bigger" can be checked if you did not change the size of the image. If The Pallet has changed check "Import Pallet" (check the Warning in the pallet section below). Select browse and choose the PNG with the new type icons, and select OK. Don't forget to save after the image is imported. 'Pallet' WARNING: The pallet for the type icons also affects other items in the game. Examples of this include the pokeball in the Dex list, and various text in the game. The color pallet for the type icon sprites are referenced on the "Icons" tab, and includes the location and pointer location. The pallet for this project has been modified to enhance the available colors, but did not include reordering indexed colors. it is advisable to not make any major changes to the pallet unless you are going to thoroughly check for impacted elements in the game. All colors in the ROM are 5 bit per RGB channel instead of the 8 bit used in graphic editors. The byte for each color channel must end in 0 or 8 in order for colors not to be changed when the pallet is imported. For each indexed color this is visually represented by RRGGBBh = RRRRRRRRGGGGGGGGBBBBBBBBb -> RRRRRXXXGGGGGXXXBBBBBXXXb -> 0BBBBBGGGGGRRRRRb where X represents the removed bits, h is in hexadecimal, and b is in bits. When importing a pallet to the ROM, set GBA Graphics Editor the same as to extract the image, and select a bitmap. The compressed graphics on Image Control (Windows>Image Control) and "Compressed ROMpallet" Pallet Control (Windows>Image Control) should have automatically unchecked when the pointers to the image and pallet were entered. Make sure "Import Pallet" is checked, and the rest is unchecked for both Graphics and Pallet sections. "Abort if new graphics are bigger" can be checked if you did not change the size of the image. If The image has changed check "Import Graphics". Select browse and choose the PNG with the new type icons pallet, and select OK. Don't forget to save after the pallet is imported. 'Icon Sprite Locator' Most of the "Icons" table assembles the code that the game uses to locate the Icons on the icons tile set. This is referred to as the "type icon sprite locator table". The table lists the size of the sprite in pixels in increments of 8, and the location of the sprite in number of 8X8px squares from the upper left hand corner. The image to the right is used to identify the row and column used in the table. simply identify the number of row and column in the included image, and type those numbers into the table. Unless there is going to be a major overhaul of the background graphics that the type icons are used in front of, there are places that make it best to keep the visible height and height in the table to 12 pixels. The width of the icons place them together without spacing in the status and Dex screens. They can be made smaller or without backgrounds without overrunning the graphics on the play screens. To export the data, see the table instructions and instructions in the "Importing And Exporting" section above. 'Interactions' Type interactions controls how effective each type has on the others. The "TypeInteractions" tab is the input table for the interactions. The interactions output is on the "TypeInterCoding" tab. The game programing assumes that all interactions between types are 1 to 1 unless otherwise listed in the interactions table. The code recognizes and displays messages for interactions of x2, x0.5, and x0. Other interactions can be put in the table between 0.1 and 25.5 in increments of 0.1, but will not display messages about effectiveness. To export the interactions code, the entire output area with medium green background (Turquoise 2) must be exported together. See the "Importing And Exporting" section above and the "TypeInterCoding" tab for instructions. Back to Wiki Help Suggestions and Tasks Category:Tutorials